/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UnidadeIII_8_9;
/**
 *
 * @author gustavokatel
 */
public class Questao1 {
    
    private String filename,sep="/";

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public String path()
    {
        return this.filename.substring(0,this.filename.lastIndexOf("."));
    }
    
    public String extension()
    {
        return this.filename.substring(this.filename.lastIndexOf("."));
    }
    
    public String name()
    {
        return this.filename.substring(this.filename.lastIndexOf(sep)+1, this.filename.lastIndexOf("."));
    }
    
    public Questao1(String filename)
    {
        this.filename = filename;
        if(this.filename.indexOf("/")>=0)
        {
            sep="/";
        }
        else
        {
            sep="\\";
        }
    }
    
}
